home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / AIncludes / LocationManager.a < prev    next >
Encoding:
Text File  |  1997-08-12  |  11.1 KB  |  356 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        LocationManager.a
  3. ;
  4. ;    Contains:    LocationManager (manage preferences for different physical Locations)
  5. ;
  6. ;    Version:    Technology:    System 7.6
  7. ;                Release:    Universal Interfaces 3.0.1
  8. ;
  9. ;    Copyright:    © 1995-1997 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Bugs?:        Please include the the file and version information (from above) with
  12. ;                the problem description.  Developers belonging to one of the Apple
  13. ;                developer programs can submit bug reports to:
  14. ;
  15. ;                    devsupport@apple.com
  16. ;
  17. ;
  18.     IF &TYPE('__LOCATIONMANAGER__') = 'UNDEFINED' THEN
  19. __LOCATIONMANAGER__ SET 1
  20.  
  21.     IF &TYPE('__APPLEEVENTS__') = 'UNDEFINED' THEN
  22.     include 'AppleEvents.a'
  23.     ENDIF
  24.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  25.     include 'Components.a'
  26.     ENDIF
  27.     IF &TYPE('__DIALOGS__') = 'UNDEFINED' THEN
  28.     include 'Dialogs.a'
  29.     ENDIF
  30.     IF &TYPE('__PROCESSES__') = 'UNDEFINED' THEN
  31.     include 'Processes.a'
  32.     ENDIF
  33.     IF &TYPE('__STANDARDFILE__') = 'UNDEFINED' THEN
  34.     include 'StandardFile.a'
  35.     ENDIF
  36.  
  37. ;  Location Manager API Support -------------------------------------------------------------------- 
  38. ;  A Location Token uniquely identifies a Location on a machine... 
  39.  
  40.  
  41.  
  42.  
  43. kALMNoLocationToken                EQU        -1                    ; ALMToken of "off" Location...
  44.  
  45. kALMLocationNameMaxLen            EQU        31                    ; name (actually imposed by file system)... 
  46. kALMMaxLocations                EQU        16                    ; arbitrary limit enforced by Location Manager... 
  47. kALMNoLocationIndex                EQU        -1                    ; index for the "off" Location (kALMNoLocationToken)... 
  48. ALMLocationName            RECORD 0
  49. f                         ds        Str31
  50. sizeof                     EQU *                    ; size:   $20 (32)
  51.                         ENDR
  52.  
  53.  
  54. ;  Returned from ALMConfirmName... 
  55. ; typedef SInt16                         ALMConfirmChoice
  56.  
  57.  
  58. kALMConfirmRename                EQU        1
  59. kALMConfirmReplace                EQU        2
  60. ;  ALMConfirmName dialog item numbers for use in callbacks (ALM 2.0)... 
  61.  
  62.  
  63. kALMDuplicateRenameButton        EQU        1                    ; if Window refcon is kALMDuplicateDialogRefCon... 
  64. kALMDuplicateReplaceButton        EQU        2
  65. kALMDuplicateCancelButton        EQU        3
  66. kALMDuplicatePromptText            EQU        5
  67.  
  68. kALMRenameRenameButton            EQU        1                    ; if Window refcon is kALMRenameDialogRefCon... 
  69. kALMRenameCancelButton            EQU        2
  70. kALMRenameEditText                EQU        3
  71. kALMRenamePromptText            EQU        4
  72. ;  Refcons of two windows in ALMConfirmName (ALM 2.0)... 
  73.  
  74.  
  75. kALMDuplicateDialogRefCon        EQU        'dupl'
  76. kALMRenameDialogRefCon            EQU        'rnam'
  77. ;  Callback routine for Location awareness (mimics AppleEvents) in non-application code... 
  78.  
  79. ;  Notification AppleEvents sent to apps/registered code...  
  80.  
  81. kAELocationChangedNoticeKey        EQU        'walk'                ; Current Location changed... 
  82. kAELocationRescanNoticeKey        EQU        'trip'                ; Location created/renamed/deleted... 
  83. ;  ALMSwitchToLocation masks... 
  84.  
  85. ; typedef SInt32                         ALMSwitchActionFlags
  86.  
  87.  
  88. kALMDefaultSwitchFlags            EQU        $00000000            ; No special action to take... 
  89. kALMDontShowStatusWindow        EQU        $00000001            ; Suppress "switching" window... 
  90. kALMSignalViaAE                    EQU        $00000002            ; Switch by sending Finder AppleEvent... 
  91. ;  Parameters for Get/Put/Merge Location calls... 
  92.  
  93. ; typedef const OSType *                ConstALMModuleTypeListPtr
  94.  
  95.  
  96. kALMAddAllOnSimple                EQU        0                    ; Add all single-instance, non-action modules... 
  97. kALMAddAllOff                    EQU        -1                    ; Add all modules but turn them off... 
  98. ;  Item numbers for use in Get/Put/Merge Location filters... 
  99.  
  100.  
  101. kALMLocationSelectButton        EQU        1
  102. kALMLocationCancelButton        EQU        2
  103. kALMLocationBalloonHelp            EQU        3
  104. kALMLocationLocationList        EQU        7
  105. kALMLocationLocationNameEdit    EQU        10
  106. kALMLocationPromptText            EQU        11
  107.  
  108. kALMLocationSaveButton            EQU        1
  109. ;  Location Manager Module API Support ------------------------------------------------------------- 
  110.  
  111. ;  ALMGetScriptInfo stuff... 
  112.  
  113.  
  114. kALMScriptInfoVersion            EQU        2                    ; Customarily put in resource for localization... 
  115. ALMScriptManagerInfo    RECORD 0
  116. version                     ds.w    1                ; offset: $0 (0)        ;  Set to kALMScriptInfoVersion... 
  117. scriptCode                 ds.w    1                ; offset: $2 (2)
  118. regionCode                 ds.w    1                ; offset: $4 (4)
  119. langCode                 ds.w    1                ; offset: $6 (6)
  120. fontNum                     ds.w    1                ; offset: $8 (8)
  121. fontSize                 ds.w    1                ; offset: $A (10)
  122. sizeof                     EQU *                    ; size:   $C (12)
  123.                         ENDR
  124. ; typedef struct ALMScriptManagerInfo *    ALMScriptManagerInfoPtr
  125.  
  126.  
  127. ;   Alternate form of ScriptInfo is easier to localize in resources; it is used extensively in
  128. ;   samples and internally, so....
  129.  
  130.  
  131. ALMAltScriptManagerInfo    RECORD 0
  132. version                     ds.w    1                ; offset: $0 (0)
  133. scriptCode                 ds.w    1                ; offset: $2 (2)
  134. regionCode                 ds.w    1                ; offset: $4 (4)
  135. langCode                 ds.w    1                ; offset: $6 (6)
  136. fontSize                 ds.w    1                ; offset: $8 (8)
  137. fontName                 ds        Str63            ; offset: $A (10)
  138. sizeof                     EQU *                    ; size:   $4A (74)
  139.                         ENDR
  140. ; typedef struct ALMAltScriptManagerInfo * ALMAltScriptManagerInfoPtr
  141.  
  142. ; typedef ALMAltScriptManagerInfoPtr *    ALMAltScriptManagerInfoHandle
  143.  
  144.  
  145. kALMAltScriptManagerInfoRsrcType EQU    'trip'
  146. kALMAltScriptManagerInfoRsrcID    EQU        0
  147. ;  Reboot information used on ALMSetCurrent (input/output parameter)... 
  148.  
  149. ; typedef UInt32                         ALMRebootFlags
  150.  
  151.  
  152. kALMNoChange                    EQU        0
  153. kALMAvailableNow                EQU        1
  154. kALMFinderRestart                EQU        2
  155. kALMProcesses                    EQU        3
  156. kALMExtensions                    EQU        4
  157. kALMWarmBoot                    EQU        5
  158. kALMColdBoot                    EQU        6
  159. kALMShutdown                    EQU        7
  160.  
  161. ;   File types and signatures...
  162. ;   Note: auto-routing of modules will not be supported for 'thng' files...
  163.  
  164.  
  165.  
  166.  
  167. kALMFileCreator                    EQU        'fall'                ; Creator of Location Manager files... 
  168. kALMComponentModuleFileType        EQU        'thng'                ; Type of a Component Manager Module file [v1.0]... 
  169. kALMComponentStateModuleFileType EQU    'almn'                ; Type of a CM 'state' Module file... 
  170. kALMComponentActionModuleFileType EQU    'almb'                ; Type of a CM 'action' Module file... 
  171. kALMCFMStateModuleFileType        EQU        'almm'                ; Type of a CFM 'state' Module file... 
  172. kALMCFMActionModuleFileType        EQU        'alma'                ; Type of a CFM 'action' Module file... 
  173. ;  Component Manager 'thng' info... 
  174.  
  175.  
  176. kALMComponentRsrcType            EQU        'thng'
  177. kALMComponentType                EQU        'walk'
  178. ;  CFM Modules require a bit of information (replacing some of the 'thng' resource)... 
  179.  
  180.  
  181. kALMModuleInfoRsrcType            EQU        'walk'
  182. kALMModuleInfoOriginalVersion    EQU        0
  183. ;  These masks apply to the "Flags" field in the 'thng' or 'walk' resource... 
  184.  
  185.  
  186. kALMMultiplePerLocation            EQU        $00000001            ; Module can be added more than once to a Location... 
  187. kALMDescriptionGetsStale        EQU        $00000002            ; Descriptions may change though the setting didn't...  
  188. ;  Misc stuff for older implementations ------------------------------------------------------------ 
  189.  
  190.     IF OLDROUTINENAMES THEN
  191. ;  Old error codes for compatibility - new names are in Errors interface... 
  192.  
  193. ALMInternalErr                    EQU        -30049                ; use kALMInternalErr 
  194. ALMLocationNotFound                EQU        -30048                ; use kALMLocationNotFoundErr 
  195. ALMNoSuchModuleErr                EQU        -30047                ; use kALMNoSuchModuleErr 
  196. ALMModuleCommunicationErr        EQU        -30046                ; use kALMModuleCommunicationErr 
  197. ALMDuplicateModuleErr            EQU        -30045                ; use kALMDuplicateModuleErr 
  198. ALMInstallationErr                EQU        -30044                ; use kALMInstallationErr 
  199. ALMDeferSwitchErr                EQU        -30043                ; use kALMDeferSwitchErr 
  200. ;  Old ALMConfirmName constants... 
  201.  
  202.  
  203. ALMConfirmRenameConfig            EQU        1
  204. ALMConfirmReplaceConfig            EQU        2
  205. ;  Old AppleEvents... 
  206.  
  207.  
  208. kAELocationNotice                EQU        'walk'
  209. ALMScriptMgrInfo        RECORD 0
  210. f                         ds        ALMScriptManagerInfo
  211. sizeof                     EQU *                    ; size:   $C (12)
  212.                         ENDR
  213.  
  214.  
  215. ; typedef UInt32                         ALMComponentFlagsEnum
  216.  
  217.     ENDIF    ; OLDROUTINENAMES
  218. ;  Location Manager API ---------------------------------------------------------------------------- 
  219.  
  220. ;  The following 7 routines are present if gestaltALMAttr has bit gestaltALMPresent set... 
  221.  
  222. ;
  223. ; pascal OSErr ALMGetCurrentLocation(SInt16 *index, ALMToken *token, ALMLocationName name)
  224. ;
  225.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  226.         Macro
  227.         _ALMGetCurrentLocation
  228.             move.w              #$0600,D0
  229.             dc.w                $AAA4
  230.         EndM
  231.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  232.         IMPORT_CFM_FUNCTION ALMGetCurrentLocation
  233.     ENDIF
  234.  
  235. ;
  236. ; pascal OSErr ALMGetIndLocation(SInt16 index, ALMToken *token, ALMLocationName name)
  237. ;
  238.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  239.         Macro
  240.         _ALMGetIndLocation
  241.             move.w              #$0501,D0
  242.             dc.w                $AAA4
  243.         EndM
  244.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  245.         IMPORT_CFM_FUNCTION ALMGetIndLocation
  246.     ENDIF
  247.  
  248. ;
  249. ; pascal OSErr ALMCountLocations(SInt16 *locationCount)
  250. ;
  251.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  252.         Macro
  253.         _ALMCountLocations
  254.             move.w              #$0202,D0
  255.             dc.w                $AAA4
  256.         EndM
  257.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  258.         IMPORT_CFM_FUNCTION ALMCountLocations
  259.     ENDIF
  260.  
  261. ;
  262. ; pascal OSErr ALMSwitchToLocation(ALMToken newLocation, ALMSwitchActionFlags switchFlags)
  263. ;
  264.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  265.         Macro
  266.         _ALMSwitchToLocation
  267.             move.w              #$0403,D0
  268.             dc.w                $AAA4
  269.         EndM
  270.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  271.         IMPORT_CFM_FUNCTION ALMSwitchToLocation
  272.     ENDIF
  273.  
  274. ;
  275. ; pascal OSErr ALMRegisterNotifyProc(ALMNotificationUPP notificationProc, const ProcessSerialNumber *whichPSN)
  276. ;
  277.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  278.         Macro
  279.         _ALMRegisterNotifyProc
  280.             move.w              #$0404,D0
  281.             dc.w                $AAA4
  282.         EndM
  283.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  284.         IMPORT_CFM_FUNCTION ALMRegisterNotifyProc
  285.     ENDIF
  286.  
  287. ;
  288. ; pascal OSErr ALMRemoveNotifyProc(ALMNotificationUPP notificationProc, const ProcessSerialNumber *whichPSN)
  289. ;
  290.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  291.         Macro
  292.         _ALMRemoveNotifyProc
  293.             move.w              #$0405,D0
  294.             dc.w                $AAA4
  295.         EndM
  296.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  297.         IMPORT_CFM_FUNCTION ALMRemoveNotifyProc
  298.     ENDIF
  299.  
  300. ;
  301. ; pascal OSErr ALMConfirmName(ConstStr255Param message, Str255 theName, ALMConfirmChoice *choice, ModalFilterUPP filter)
  302. ;
  303.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  304.         Macro
  305.         _ALMConfirmName
  306.             move.w              #$0806,D0
  307.             dc.w                $AAA4
  308.         EndM
  309.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  310.         IMPORT_CFM_FUNCTION ALMConfirmName
  311.     ENDIF
  312.  
  313. ;  The following 3 routines are present if gestaltALMAttr has bit gestaltALMHasSFLocation set... 
  314.  
  315. ;
  316. ; pascal OSErr ALMPutLocation(ConstStr255Param prompt, ALMLocationName name, SInt16 numTypes, ConstALMModuleTypeListPtr typeList, ModalFilterYDUPP filter, void *yourDataPtr)
  317. ;
  318.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  319.         Macro
  320.         _ALMPutLocation
  321.             move.w              #$0B07,D0
  322.             dc.w                $AAA4
  323.         EndM
  324.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  325.         IMPORT_CFM_FUNCTION ALMPutLocation
  326.     ENDIF
  327.  
  328. ;
  329. ; pascal OSErr ALMGetLocation(ConstStr255Param prompt, ALMLocationName name, ModalFilterYDUPP filter, void *yourDataPtr)
  330. ;
  331.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  332.         Macro
  333.         _ALMGetLocation
  334.             move.w              #$0808,D0
  335.             dc.w                $AAA4
  336.         EndM
  337.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  338.         IMPORT_CFM_FUNCTION ALMGetLocation
  339.     ENDIF
  340.  
  341. ;
  342. ; pascal OSErr ALMMergeLocation(ConstStr255Param prompt, ALMLocationName name, SInt16 numTypes, ConstALMModuleTypeListPtr typeList, ModalFilterYDUPP filter, void *yourDataPtr)
  343. ;
  344.     IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
  345.         Macro
  346.         _ALMMergeLocation
  347.             move.w              #$0B09,D0
  348.             dc.w                $AAA4
  349.         EndM
  350.     ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
  351.         IMPORT_CFM_FUNCTION ALMMergeLocation
  352.     ENDIF
  353.  
  354.     ENDIF ; __LOCATIONMANAGER__ 
  355.  
  356.